function t(t, e, o, s) {
    var n = getApp().globalData.baseUrl, d = a.HEADER;
    return getApp().globalData.token && (d.token = getApp().globalData.token), o && (o.v = new Date().getTime()), 
    wx.showNavigationBarLoading(), new Promise(function(u, i) {
        wx.request({
            url: n + "/" + t,
            method: e || "POST",
            header: d,
            data: o,
            success: function(t) {
                0 == t.data.c ? u(t.data) : (getApp().hideLoading(), -1 !== [ 1e4, 110 ].indexOf(t.data.c) ? getApp().showModal(t.data.m, function() {
                    getApp().globalData.token = "", wx.clearStorageSync(), wx.reLaunch({
                        url: a.AUTHORIZE_PAGE_URL
                    });
                }) : 1 == s ? i(t.data) : t.data.m ? t.data.m.length < 6 ? getApp().error(t.data.m) : getApp().text(t.data.m) : i(t.data));
            },
            complete: function(t) {
                wx.hideNavigationBarLoading(), wx.stopPullDownRefresh(), 200 != t.statusCode && wx.hideLoading(), 
                t.statusCode = t.statusCode ? t.statusCode : "", 504 == t.statusCode ? getApp().showModal("网关超时" + t.statusCode, function() {
                    wx.navigateBack();
                }, "提示" + t.statusCode) : 500 != t.statusCode && 504 == t.statusCode ? getApp().showModal("请求超时" + t.statusCode, function() {
                    wx.navigateBack();
                }, "提示 " + t.statusCode) : 500 == t.statusCode ? getApp().showModal("服务器发生错误" + t.statusCode, function() {
                    wx.navigateBack();
                }, "提示 " + t.statusCode) : 200 != t.statusCode && getApp().showModal("网络超时" + t.statusCode, function() {
                    wx.navigateBack();
                }, "提示 " + t.statusCode);
            },
            fail: function(t) {
                wx.hideLoading(), getApp().text("服务器开小差了~");
            }
        });
    });
}

Object.defineProperty(exports, "__esModule", {
    value: !0
}), exports.default = t;

var a = require("./../config.js");

[ "options", "get", "post", "put", "head", "delete", "trace", "connect" ].forEach(function(a) {
    t[a] = function(e, o, s) {
        return t(e, a, o, s || {});
    };
});